const app = getApp()
Page({
  data:{
      jifen:'',
  },
  onShow: function (res) {
    var that = this
    var openid = app.globalData.openid;
    console.log(openid)
    if (openid == null) {

      wx.switchTab({
        url: '/pages/my/my',
        success: function (res) {
          wx.showToast({
            title: '请登入后操作',
            icon: 'none',
            duration: 2000
          })
        }
      })

    } else {
      //积分
      wx.request({
        url: app.globalData.apiUrl + '/api/user/integral',
        data: { openid: openid },
        method: 'GET',
        dataType: 'json',
        success: function (res) {
          console.log(res)
          that.setData({ jifen: res.data.integral })
        },
        fail: function (res) { },
        complete: function (res) { },
      })
    }

  }
})